package com.xrit.sunnyday.controller;

import com.xrit.sunnyday.constant.MessageConstant;
import com.xrit.sunnyday.entity.Result;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类名称: UserController
 * 类描述:TODO
 * 创建人: czb
 * 创建时间:2022/7/7 上午 11:07
 * Version 1.0.0
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @GetMapping("/GetLoginUsername")
    public Result GetLoginUsername(){
        return new Result(true, MessageConstant.GET_USERNAME_SUCCESS,  SecurityContextHolder.getContext().getAuthentication().getName());
    }
}
